package com.xuebang.admin.util;

import java.io.File;
import java.io.FileInputStream;


import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;

public class ReadExcel {
	
	private String file; // 文件名字
	
	// 构造方法
	public ReadExcel(){}
	// 有参构造方法
	public ReadExcel(String file){
		this.file = file;
	}
	
	public void setFile(String file){
		this.file = file;
	}
	public String getFile(){
		return this.file;
	}
	
/*	public Object read(){
		BankFinanceProduct bfp = new BankFinanceProduct();
		try {
			// 導入excel 文件夾
			FileInputStream is = new FileInputStream(this.file);
			HSSFWorkbook workbook = new HSSFWorkbook(is);
			HSSFSheet sheet = workbook.getSheetAt(0);
			int frnum = sheet.getFirstRowNum();
			int lrnum = sheet.getLastRowNum();
			int rnum = lrnum - frnum + 1;
			for (int i = 0; i < rnum; i++) {
				HSSFRow row = sheet.getRow(i);
				if (row.getCell(0) != null) {
					row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
					System.out.println(row.getCell(0).getStringCellValue());
				}
				System.out.println(row.getCell(1).getStringCellValue());
//				user.setUser(row.getCell(1).getStringCellValue());
				if (row.getCell(2) != null) {
					row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
					System.out.println(row.getCell(2).getStringCellValue());
//					user.setPasswd(row.getCell(2).getStringCellValue());
				}
				if (row.getCell(3) != null) {
					row.getCell(3).setCellType(Cell.CELL_TYPE_STRING);
//					System.out.println(row.getCell(3).getStringCellValue());
//					user.setPhone(row.getCell(3).getStringCellValue());
				}
//	            finder.
//				session.save(user);
//				tx.commit();
//				session.close();
			}
		} catch (Exception e) {
			System.out.println(e.toString());
		}
		return bfp;
	}*/
}
